/**
 * 
 */
package br.com.cotec.controller;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;
import javax.faces.model.SelectItem;

import br.com.cotec.manager.RoleNamesManager;
import br.com.cotec.model.RoleNames;

/**
 * @author Magalhaes
 *
 */
public class RoleNamesMB {
	
	@EJB(name = "roleNamesManager")
	private RoleNamesManager roleNamesManager;
	
	public List<SelectItem> roleOpts;
	
	public List<SelectItem> getRoleOpts() {
		return geraListagemRoleNames();
	}
	
	public List<SelectItem> geraListagemRoleNames() {
		List<RoleNames> roleList = roleNamesManager.getAll(new RoleNames());
		List<SelectItem> roleItem = new ArrayList<SelectItem>();
		for (RoleNames roleBean : roleList) {
			roleItem.add(new SelectItem(roleBean.getDescription(), roleBean.getId().toString()));
		}
		return roleItem;
	}
}